#!/usr/bin/python

import web
from config import *
from lib import *

mc = MC(msgDB)
class send:
    def POST(self):
        user = self.chklogin()
        if(user == None):
            return "NO_LOGIN"
        i = web.input()
        try:
            msg = i.msg
            to = i.to
            if(msg == '' or to == ''):
                return "NO_TO_MSG"
            else:
                key = "{%s:%s}" % (user,to)
                mc.set(key,msg)
        except e:
            return "ERROR"
        return i.msg
    
    def chklogin(self):
        mcu = MC(userDB)
        user = chklogin(web,mcu)
        if(user):
            return user
        else:
            return None
            
            

class fetch:
    def GET(self):
        i = web.input() 
